package com.news.service.impl;

import com.news.mapper.RecordMapper;
import com.news.model.Record;
import com.news.model.RecordExample;
import com.news.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecordServiceImpl implements RecordService{

    @Autowired
    private RecordMapper recordMapper;
    @Override
    public void insert(Record record) {
        recordMapper.insert(record);
    }

    @Override
    public List<Record> queryUser() {
        return recordMapper.queryAll();
    }

    @Override
    public List<Record> queryOne(String userid) {
        RecordExample recordExample = new RecordExample();
        recordExample.or().andUseridEqualTo(userid);
        List<Record> records = recordMapper.selectByExample(recordExample);
        return records;
    }
}
